#ifndef __MEMCG_FILE__
#define __MEMCG_FILE__
#include <linux/radix-tree.h>
#include "common.h"

#define INODE_LIMIT (50)
struct memcg_info {
    int nr ;/* number of memcg for dying*/
    struct list_head head; /* memcg offline*/
};

struct memcg_item {
    struct radix_tree_root inode_root;
    struct list_head head;
    struct list_head offline;
    unsigned long  anon;
    unsigned long  shmem;
    unsigned long  file;
    unsigned long size;
    int num_file;
    struct mem_cgroup *memcg;
    char *cgname;
};

struct inode_item_user {
    unsigned long i_ino;
    int nr_pages;
    int deleted:4;
    int shmem:4;
    unsigned long cached;
    char filename[NAME_LEN];
};
struct memcg_item_user {
    struct inode_item_user *inode_items;
    unsigned long  anon;
    unsigned long  shmem;
    unsigned long  file;
    unsigned long size;
    int num_file;
    char cgname[NAME_LEN];
};

struct memcg_info_user {
    int nr ;/* number of memcg for dying*/
    struct memcg_item_user* items;
    char cgname[NAME_LEN];
};
void memcg_dump(struct memcg_info *info);
void memcg_free_all(struct memcg_info *info);
int memcg_scan(struct memcg_info *info, struct mem_cgroup *start, int offline);
int memcg_dying_main(unsigned long arg);
int memcg_one_main(unsigned long arg);
struct mem_cgroup *memcg_get_by_name(char *cgname);
#endif
